//
//  SceneManager.m
//  SceneManager
//
//  Created by MajorTom on 9/7/10.
//  Copyright iphonegametutorials.com 2010. All rights reserved.
//

#import "SceneManager.h"
#import "CCScrollLayer.h"
#import "levelayerManager.h"
#define TRANSITION_DURATION (1.2f)
@interface SceneManager ()
+(void) go: (CCLayer *) layer;
+(CCScene *) wrap: (CCLayer *) layer;
@end


@implementation SceneManager

+(void) goPlay{
	CCLayer *layer = [levelayerManager node];
   //[(PlayLayer*)layer gotonextMM :1];
	[SceneManager go: layer];
}

+(void) go: (CCLayer *) layer{
	CCDirector *director = [CCDirector sharedDirector];
	CCScene *newScene = [SceneManager wrap:layer];
	
	if ([director runningScene]) {
		//[director replaceScene:newScene];
        
        [director replaceScene: [CCTransitionSplitRows transitionWithDuration:TRANSITION_DURATION scene:newScene]];

        
	}else {
		[director runWithScene:newScene];	
        
	}
}

+(CCScene *) wrap: (CCLayer *) layer{
	CCScene *newScene = [CCScene node];
	[newScene addChild: layer];
	return newScene;
}

@end
